package edu.nf.pagehelper.service;

import com.github.pagehelper.PageInfo;
import edu.nf.pagehelper.entity.City;
import edu.nf.pagehelper.mapper.CityMapper;
import edu.nf.pagehelper.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author CSY
 * @date 2025 - 04 - 25
 */
public class CityService {
    public PageInfo<City> pageCity(int pageNum, int pageSize){
        try(SqlSession session = MybatisUtils.getSqlSession()){
            List<City> cities = session.getMapper(CityMapper.class).pageCity(pageNum, pageSize);
            return new PageInfo<>(cities);
        }
    }
}
